Allow a dom0 kernel to run as domU.
{
int i;
-#ifdef CONFIG_XEN_PHYSDEV_ACCESS
+#ifdef CONFIG_XEN_PRIVILEGED_GUEST
probe_roms();
#endif
for (i = 0; i < e820.nr_map; i++) {
register_memory(max_low_pfn);
-#ifdef CONFIG_VT
-#if defined(CONFIG_VGA_CONSOLE)
- if (!efi_enabled || (efi_mem_type(0xa0000) != EFI_CONVENTIONAL_MEMORY))
- conswitchp = &vga_con;
-#elif defined(CONFIG_DUMMY_CONSOLE)
- conswitchp = &dummy_con;
-#endif
-#endif
-
/* If we are a privileged guest OS then we should request IO privs. */
if (start_info.flags & SIF_PRIVILEGED) {
dom0_op_t op;
panic("Unable to obtain IOPL, despite SIF_PRIVILEGED");
current->thread.io_pl = 1;
}
+
+ if (start_info.flags & SIF_INITDOMAIN) {
+ if (!(start_info.flags & SIF_PRIVILEGED))
+ panic("Xen granted us console access "
+ "but not privileged status");
+
+#ifdef CONFIG_VT
+#if defined(CONFIG_VGA_CONSOLE)
+ if (!efi_enabled ||
+ (efi_mem_type(0xa0000) != EFI_CONVENTIONAL_MEMORY))
+ conswitchp = &vga_con;
+#elif defined(CONFIG_DUMMY_CONSOLE)
+ conswitchp = &dummy_con;
+#endif
+#endif
+ } else {
+#if defined(CONFIG_VGA_CONSOLE)
+ /* disable VGA driver */
+ ORIG_VIDEO_ISVGA = VIDEO_TYPE_VLFB;
+#endif
+ }
}
#include "setup_arch_post.h"
#ifdef CONFIG_XEN_PRIVILEGED_GUEST
/* Setup mapping of lower 1st MB */
for (i = 0; i < NR_FIX_ISAMAPS; i++)
- set_fixmap_ma(FIX_ISAMAP_BEGIN - i, i * PAGE_SIZE);
+ if (start_info.flags & SIF_PRIVILEGED)
+ set_fixmap_ma(FIX_ISAMAP_BEGIN - i, i * PAGE_SIZE);
+ else
+ set_fixmap_ma_ro(FIX_ISAMAP_BEGIN - i,
+ virt_to_machine(empty_zero_page));
#endif
}
static int __init xencons_setup(char *str)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+ if (str[0] == '=')
+ str++;
+#endif
if ( !strcmp(str, "tty") )
xc_mode = XC_TTY;
else if ( !strcmp(str, "ttyS") )
else
{
if ( xc_mode == XC_DEFAULT )
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) && defined(CONFIG_VT)
+ /* On a kernel built with VT support, default to serial
+ * console because the VT driver has already allocated the
+ * /dev/tty device nodes */
+ xc_mode = XC_SERIAL;
+#else
xc_mode = XC_TTY;
+#endif
kcons_info.write = kcons_write;
}
__set_fixmap(idx, phys, PAGE_KERNEL)
#define set_fixmap_ma(idx, phys) \
__set_fixmap_ma(idx, phys, PAGE_KERNEL)
+#define set_fixmap_ma_ro(idx, phys) \
+ __set_fixmap_ma(idx, phys, PAGE_KERNEL_RO)
/*
* Some hardware wants to get fixmapped without caching.
*/
#ifdef SLOW_IO_BY_JUMPING
#define __SLOW_DOWN_IO "jmp 1f; 1: jmp 1f; 1:"
-#else
+#elif defined(__UNSAFE_IO__)
#define __SLOW_DOWN_IO "outb %%al,$0x80;"
+#else
+#define __SLOW_DOWN_IO "\n1: outb %%al,$0x80\n" \
+ "2:\n" \
+ ".section __ex_table,\"a\"\n\t" \
+ ".align 4\n\t" \
+ ".long 1b,2b\n" \
+ ".previous"
#endif
static inline void slow_down_io(void) {
static inline unsigned type in##bwl(int port) { \
return in##bwl##_quad(port, 0); \
}
-#else
+#else
#define __BUILDIO(bwl,bw,type) \
static inline void out##bwl(unsigned type value, int port) { \
out##bwl##_local(value, port); \
#endif
-#define BUILDIO(bwl,bw,type) \
+#if __UNSAFE_IO__
+#define ____BUILDIO(bwl,bw,type) \
static inline void out##bwl##_local(unsigned type value, int port) { \
__asm__ __volatile__("out" #bwl " %" #bw "0, %w1" : : "a"(value), "Nd"(port)); \
} \
unsigned type value; \
__asm__ __volatile__("in" #bwl " %w1, %" #bw "0" : "=a"(value) : "Nd"(port)); \
return value; \
+}
+#else
+#define ____BUILDIO(bwl,bw,type) \
+static inline void out##bwl##_local(unsigned type value, int port) { \
+ __asm__ __volatile__("1: out" #bwl " %" #bw "0, %w1\n" \
+ "2:\n" \
+ ".section __ex_table,\"a\"\n\t" \
+ ".align 4\n\t" \
+ ".long 1b,2b\n" \
+ ".previous" : : "a"(value), "Nd"(port)); \
} \
+static inline unsigned type in##bwl##_local(int port) { \
+ unsigned type value; \
+ __asm__ __volatile__("1:in" #bwl " %w1, %" #bw "0\n" \
+ "2:\n" \
+ ".section .fixup,\"ax\"\n" \
+ "3: mov" #bwl " $~0,%" #bw "0\n\t" \
+ "jmp 2b\n" \
+ ".previous\n" \
+ ".section __ex_table,\"a\"\n\t" \
+ ".align 4\n\t" \
+ ".long 1b,3b\n" \
+ ".previous" : "=a"(value) : "Nd"(port)); \
+ return value; \
+}
+#endif
+
+#define BUILDIO(bwl,bw,type) \
+____BUILDIO(bwl,bw,type) \
static inline void out##bwl##_local_p(unsigned type value, int port) { \
out##bwl##_local(value, port); \
slow_down_io(); \